import { getExcelData } from './src/utils/xlsxUtil';
import { gcj02towgs84 } from './src/utils/gpsUtils';
import { calc } from './src/helper/hllHelper';

const main = async () => {
    const list = await getExcelData('./in/20240221_1708481917_sample.xlsx');
    const item: any = list[0];
    console.log(item);
    console.log(gcj02towgs84(Number(item['起点经度']), Number(item['起点维度'])));
    // const data = await calc(item['城市'], item['区县'], item['对方车型'], item['起点'], item['终点'], item['发单时间'], item['起点经度'], item['起点维度'], item['终点经度'], item['终点维度']);

    const header = [
        'route_id',
        'city',	
        'district',	
        'vehicle_type',
        'start',
        'end',
        'is_multiple_price',	
        'total_distance',
        'start_distance',
        'start_price',
        'exceed_distance',
        'exceed_price',
        'distance_price',
        'surcharge_service_type',
        'surcharge_service_price',
        'coupon_type',
        'coupon',
        'finalPriceWithoutCoupon',	
        'finalPrice',
        'orderTime'
    ];

    $sheet->setCellValue('A' . $rowIndex, $row['routeId']);
            $sheet->setCellValue('B' . $rowIndex, $row['cityName']);
            $sheet->setCellValue('C' . $rowIndex, $row['district']);
            $sheet->setCellValue('D' . $rowIndex, $row['vehicle_type']);
            $sheet->setCellValue('E' . $rowIndex, $row['start']);
            $sheet->setCellValue('F' . $rowIndex, $row['end']);
            $sheet->setCellValue('G' . $rowIndex, intval($row['is_multiple_price']));
            $sheet->setCellValue('H' . $rowIndex, $row['total_distance']);
            $sheet->setCellValue('I' . $rowIndex, $row['start_distance']);
            $sheet->setCellValue('J' . $rowIndex, floatval($row['start_price'])/100);
            $sheet->setCellValue('K' . $rowIndex, $row['exceed_distance']);
            $sheet->setCellValue('L' . $rowIndex, floatval($row['exceed_price'])/100);
            $sheet->setCellValue('M' . $rowIndex, floatval($row['distance_price'])/100);
            $sheet->setCellValue('N' . $rowIndex, $row['surcharge_service_type']);
            $sheet->setCellValue('O' . $rowIndex, floatval($row['surcharge_service_price'])/100);
            $sheet->setCellValue('P' . $rowIndex, $row['coupon_type']);
            $sheet->setCellValue('Q' . $rowIndex, floatval($row['coupon'])/100);
            $sheet->setCellValue('R' . $rowIndex, floatval($row['finalPriceWithoutCoupon'])/100);
            $sheet->setCellValue('S' . $rowIndex, floatval($row['finalPrice'])/100);
            $sheet->setCellValue('T' . $rowIndex, $row['orderTime']);
};

main();